package com.clock.shop.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.clock.common.enums.shop.ShopStatus;
import com.clock.shop.domain.ShopShop;
import com.clock.shop.domain.vo.EmployeeVo;
import com.clock.shop.domain.vo.ShopShopVo;
import com.clock.shop.mapper.ShopShopMapper;
import com.clock.shop.service.IShopShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


/**
 * 店铺Service业务层处理
 *
 * @author ruoyi
 * @date 2024-10-11
 */
@Service
public class ShopShopServiceImpl implements IShopShopService {
    @Resource
    private ShopShopMapper shopShopMapper;

    //查询店铺-根据用户名
    @Override
    public ShopShop selectShopByEmployeeName(String EmployeeName) {
        return shopShopMapper.selectShopByEmployeeName(EmployeeName);
    }

    /**
     * 查询店铺
     *
     * @param shopId 店铺主键
     * @return 店铺
     */
    @Override
    public ShopShopVo selectShopShopByShopId(Long shopId) {
        return shopShopMapper.selectShopShopByShopId(shopId);
    }

    @Override
    public List<ShopShop> selectShopShopByShopName(String shopName) {
        return shopShopMapper.selectShopShopByShopName(shopName);
    }

    /**
     * 查询店铺列表
     *
     * @param shopShopVo 店铺
     * @return 店铺
     */
    @Override
    public List<ShopShopVo> selectShopShopList(ShopShopVo shopShopVo) {
        List<ShopShopVo> shopShopVos = shopShopMapper.selectShopShopList(shopShopVo);
        for (ShopShopVo shopShopVo1 : shopShopVos) {
            if (shopShopVo1.getShopStatus().equals(ShopStatus.DOBUSINESS.getCode())) {
                shopShopVo1.setShopStatus(ShopStatus.DOBUSINESS.getInfo());
            } else {
                shopShopVo1.setShopStatus(ShopStatus.CLOSE.getInfo());
            }
        }
        return shopShopVos;
    }

    /**
     * 新增店铺
     *
     * @param shopShop 店铺
     * @return 结果
     */
    @Override
    public int insertShopShop(ShopShop shopShop) {
        return shopShopMapper.insertShopShop(shopShop);
    }

    /**
     * 修改店铺
     *
     * @param shopShop 店铺
     * @return 结果
     */
    @Override
    public int updateShopShop(ShopShop shopShop) {
        return shopShopMapper.updateShopShop(shopShop);
    }

    /**
     * 批量删除店铺
     *
     * @param shopIds 需要删除的店铺主键
     * @return 结果
     */
    @Override
    public int deleteShopShopByShopIds(Long[] shopIds) {
        return shopShopMapper.deleteShopShopByShopIds(shopIds);
    }

    /**
     * 删除店铺信息
     *
     * @param shopId 店铺主键
     * @return 结果
     */
    @Override
    public int deleteShopShopByShopId(Long shopId) {
        return shopShopMapper.deleteShopShopByShopId(shopId);
    }

    @Override
    public int countShopShopByBossId(Long bossId) {
        return shopShopMapper.countShopShopByBossId(bossId);
    }


}
